<turbo-frame id="<%= @resource.model_key %>_list" target="_top" class="relative w-full">
  <div class="w-full relative overflow-auto mac-styled-scrollbar"
    data-component-name="<%= self.class.to_s.underscore %>"
    data-controller="item-select-all"
    data-resource-name="<%= @resource.model_key %>"
    data-item-select-all-selected-all-value="false"
    data-item-select-all-selected-all-query-value="<%= encrypted_query %>"
    data-item-select-all-page-count-value="<%= @pagy.pages %>"
    data-selected-resources-name="<%= @resource.model_key %>"
    data-selected-resources="[]"
  >
    <% if @pagy.pages > 1 %>
      <div class="absolute z-30 w-[calc(100%-2.5rem)] ml-10 pt-px hidden" data-item-select-all-target="selectAllOverlay">
        <div class="bg-white flex items-center h-9 mt-0.5">
          <div class="mt-1.5" data-item-select-all-target="unselectedMessage">
            <%= selected_page_label %>
            <%= a_link request.url,
              size: :xs,
              color: :primary,
              class: "relative -top-[0.1rem] ml-2 cursor-pointer text-primary-500",
              data: {action: "click->item-select-all#selectAll"} do
            %>
              <%= t "avo.select_all_matching" %>
            <% end %>
          </div>
          <div class="mt-1.5" data-item-select-all-target="selectedMessage" class="hidden">
            <%= selected_all_label %>
            <%= a_link request.url,
              size: :xs,
              color: :primary,
              class: "relative -top-[0.1rem] ml-2 cursor-pointer text-primary-500",
              data: {action: "click->item-select-all#selectAll"} do
            %>
              <%= t("avo.undo").humanize %>
            <% end %>
          </div>
        </div>
      </div>
    <% end %>
    <table class="w-full px-4 bg-white">
      <%= render partial: 'avo/partials/table_header', locals: {fields: @header_fields} %>
      <%= content_tag :tbody, class: "divide-y",
        data: {
          **(try(:drag_reorder_data_attributes) || {}),
        } do %>
        <% @table_row_components.each do |table_row_component| %>
          <%= render table_row_component %>
        <% end %>
      <% end %>
    </table>
  </div>
</turbo-frame>
